Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum


  

PreviousPrevious NextNext


~Joan Froweploponi 17.Oct.03 07:02 PM a Web browser
Domino Designer 6.0.2 CF2 Windows 2000


Hello, it's been so long (had encephalitis in the mean time...) since I did anything in Java that I forgot most of what I learned.

I found this code in this forum and copied it into an agent, below the agent code. Can someone please help me understand how to call this function?

Here's the code:

import lotus.domino.*;

public class JavaAgent extends AgentBase {

public void NotesMain() {

try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();

// (Your code goes here)

} catch(Exception e) {
e.printStackTrace();
}
}
}

public class clnSendHTMLmail extends AgentBase {

public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();

// (Your code goes here)
Stream stream = session.createStream();
session.setConvertMIME(false); // Do not convert MIME to RT

Database db = agentContext.getCurrentDatabase();
Document doc = db.createDocument();
doc.replaceItemValue("Form", "Memo");
MIMEEntity body = doc.createMIMEEntity();
MIMEHeader header = body.createHeader("Subject");
header.setHeaderVal("MIME message");

header = body.createHeader("To");
boolean status = header.setHeaderVal("your_email@your_domain.com");

stream.writeText("<h1>My headline</h1><p>This is some text</p><font color=FF0000>This line is red</font><p><a href=\"http://www.google.com\">Go to Google</a>");
// body.setContentFromText(stream, "text/plain;charset=UTF-8", MIMEEntity.ENC_NONE);
body.setContentFromText(stream, "text/html;charset=UTF-8", MIMEEntity.ENC_NONE);

Vector v = new Vector();
v.addElement(session.getUserName());
v.addElement("ts@interactive.as");
v.addElement("sales@dom.com");
if(status)
doc.save(false);
else
System.out.println("ERROR: setHeaderVal() = false)");
doc.send(false,v);
doc.remove(true);

// Always set to true if set to false at the begining
session.setConvertMIME(true); // Restore conversion

} catch(Exception e) {
e.printStackTrace();
}
}
}






Java 101 help (~Joan Froweplop... 17.Oct.03)
. . Put it in an Agent in the database.... (~Dan Elhipister... 17.Oct.03)
. . . . I have it in an Agent in the databa... (~Joan Froweplop... 17.Oct.03)
. . . . . . Agents are designed to run on docum... (~Dan Elhipister... 17.Oct.03)





  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Category
Platform
Release
Advanced search

 RSS feedsRSS
All forum posts RSS
All main topics RSS